import json
import matplotlib.pyplot as plt

def read_json(data_path):
    with open(data_path, 'r') as f:
        result = json.loads(f.read())
    avg_plot_loss_list = result["avg_plot_loss_list"]
    total_time = result["total_time"]
    return avg_plot_loss_list, total_time


def show_results():
    avg_plot_loss_list, total_time = read_json('./result/result.json')
    print("总共训练时间:%ds" % (total_time))
    # 画loss图
    plt.plot(avg_plot_loss_list)
    plt.savefig('./img/eng2french_loss.png')
    plt.show()

if __name__ == '__main__':
    show_results()